package com.qst.mapreduce.wordcount.diliuzhang.dierjie;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
     //implements Writable  实现这个 Writable方法（能个把信息写出到文件中）
public class App implements Writable {
    private int count;
    private int time;
    private int consume;
    private String name;
    //重写方法  把信息写出到文件中
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeInt(count);
        dataOutput.writeInt(time);
        dataOutput.writeInt(consume);
        dataOutput.writeUTF(name);
    }
    //重写方法  把信息读出到文件中
    public void readFields(DataInput dataInput) throws IOException {
        count = dataInput.readInt();
        time = dataInput.readInt();
        consume = dataInput.readInt();
        name = dataInput.readUTF();
    }
    //重写方法  把信息读出到文件中,  并且已可读的方式看到
    public String toString() {
        return count + "\t" + time + "\t" + consume+ "\t" + name;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getConsume() {
        return consume;
    }

    public void setConsume(int consume) {
        this.consume = consume;
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

         public String getName() {
             return name;
         }

         public void setName(String name) {
             this.name = name;
         }
     }
